﻿using System;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace MyLib.Web.UI {
	/// <summary>
	/// 
	/// </summary>
	[SupportsEventValidation]
	[ToolboxData("<{0}:MyUploadImageButton runat=\"server\" />")]
	public class MyUploadImageButton : ImageButton {
		/// <summary>
		/// 
		/// </summary>
		/// <param name="e"></param>
		protected override void OnInit(EventArgs e) {
			base.OnInit(e);

			var sm = ScriptManager.GetCurrent(this.Page);
			if (sm != null) {
				sm.RegisterPostBackControl(this);
			}
		}

		/// <summary>
		/// 
		/// </summary>
		/// <param name="e"></param>
		protected override void OnLoad(EventArgs e) {
			if (this.Page.Form != null) {
				this.Page.Form.Enctype = "multipart/form-data";
			}
		}
	} // end of MyDownloadButton.
}
